package leetcode.dp;

/**
 * 70. 爬楼梯
 */
public class ClimbStairs {

    public static void main(String[] args) {
        System.out.println(climbStairs(4));
    }

    public static int climbStairs(int n) {
        if (n == 0 || n == 1 || n == 2||n==3) {
            return n;
        }
        int pre = 2;
        int curr = 3;
        for (int i = 4; i <= n; i++) {
            int tmp = curr + pre;
            pre = curr;
            curr = tmp;
        }
        return curr;
    }
}
